//
//  UserInfoTableViewController.swift
//  PaiYiChuan
//
//  Created by 刘申臣 on 2017/10/27.
//  Copyright © 2017年 刘申臣. All rights reserved.
//

import UIKit

class UserInfoTableViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {

    @IBOutlet weak var userInfoTable: UITableView!
    
    let titleArry : Dictionary<Int,[String]> = [
        0:[String](["姓名","工号"]),
        1:[String](["负责地块","所属公司","注册时间"])]
    
    @available(iOS 2.0, *)
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return titleArry[section]!.count
    }
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 10
    }
    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
        return 10
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let  cell = userInfoTable.dequeueReusableCell(withIdentifier: "userInfoCell", for: indexPath) as! UserInfoTableViewCell
        let secNo = indexPath.section
        var data = self.titleArry[secNo]
        cell.titleLabel.text = data?[indexPath.row]
        //cell.infoLabel.text = "测试"
        return cell
        
        
    }
    func numberOfSections(in tableView: UITableView) -> Int {
        return titleArry.count
    }

    
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        self.userInfoTable.dataSource = self
        self.userInfoTable.delegate = self
        let cellNib = UINib.init(nibName: "UserInfoTableViewCell", bundle: nil)
        self.userInfoTable.register(cellNib, forCellReuseIdentifier: "userInfoCell")
        self.title = "个人信息"
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
